package mc0101.mccache.scheduler;

import lombok.extern.slf4j.Slf4j;
import mc0101.mccache.thread.LocalAndRemoteRefreshThread;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
@Slf4j
public class ZcCacheInitScheduler {


    @Autowired
    private LocalAndRemoteRefreshThread localAndRemoteRefreshThread;

    @Autowired
    private ThreadPoolTaskExecutor threadPoolTaskExecutor;

    @PostConstruct
    public void init() {
        log.info("开始异步刷新本地及远程缓存！");
        threadPoolTaskExecutor.execute(localAndRemoteRefreshThread);
    }
}